package yt.kpool.adapter;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.king.base.adapter.ViewHolderRecyclerAdapter;
import com.king.base.adapter.holder.ViewHolder;

import java.util.List;

import yt.kpool.R;
import yt.kpool.activity.salesman.AgentDetailsActivity;
import yt.kpool.activity.setting.agent.myguest.GuestDetailActivity;
import yt.kpool.bean.MyAgentBean;
import yt.kpool.bean.MyGuestBean;
import yt.kpool.util.Util;


/**
 * 业务员我的代理列表
 */
public class SalemanMyAgentAdapter extends ViewHolderRecyclerAdapter<MyAgentBean.DataBean> {
    private Context context;
    public SalemanMyAgentAdapter(Context context, List<MyAgentBean.DataBean> data) {
        super(context, data);

        this.context=context;

    }
    @Override
    public View buildConvertView(LayoutInflater layoutInflater, int viewType) {
        return layoutInflater.inflate(R.layout.item_saleman_my_agent,null);
    }

    @Override
    public void bindViewDatas(ViewHolder holder, final MyAgentBean.DataBean dataBean, int position) {
        holder.setText(R.id.tv_name,dataBean.getUserName());
        holder.setText(R.id.tv_phone,dataBean.getPhone());
        holder.setText(R.id.tv_GuestNumber,""+dataBean.getGuestNumber());
        holder.setText(R.id.tv_LoginNumber,"登录次数："+dataBean.getLoginNumber()+"次");
        holder.setText(R.id.tv_Hashrate24H, Util.FormatHashrate(dataBean.getHashrate24H())+"");

        holder.getConvertView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AgentDetailsActivity.start((Activity) context,dataBean.getUserID()+"",dataBean.getUserName());
            }
        });
    }


}
